---@class Table_AnimationItem
local Table_AnimationItem = class("Table_AnimationItem");

function Table_AnimationItem:ctor()
    self.Id = 0;    --唯一ID
    self.AinmName = "";    --动画名称
    self.Layer = 0;    --优先级
    self.WrapMode = 0;    --播放模式1(1一次 2循环)
    self.PlayMode = 0;    --播放模式2
    self.QueueMode = 0;    --播放模式3
    self.Speed = 0;    --速度
    self.TransitTime = 0;    --过渡时间
    self.LoopTime = 0;    --循环次数
    self.LoopOverAnimId = 0;    --循环结束动作
    self.IsCanBreak = false;    --是否能被打断
    self.IsCallEnd = false;    --结束后是否回调
    self.NextAnimId = 0;    --结束后的下一动作
    self.SoundId = 0;    --动作音效
end

function Table_AnimationItem:Load(reader)
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Id = tonumber(self.temp); end
    self.AinmName = reader:ReadString();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Layer = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.WrapMode = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.PlayMode = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.QueueMode = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Speed = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.TransitTime = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.LoopTime = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.LoopOverAnimId = tonumber(self.temp); end
    self.IsCanBreak = reader:ReadBool();
    self.IsCallEnd = reader:ReadBool();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.NextAnimId = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.SoundId = tonumber(self.temp); end
    self.temp = nil;
end

---@class Table_AnimationMgr : IDataMgr
local Table_AnimationMgr = class("Table_AnimationMgr", IDataMgr);

function Table_AnimationMgr:FileName()
    return "Txt/Animation.txt";
end

---@return Table_AnimationItem
function Table_AnimationMgr:GetItemById(id)
    return self.super:GetItemById(id)
end

---@return Table_AnimationItem
function Table_AnimationMgr:GetItemByIdx(idx)
    return self.super:GetItemByIdx(idx)
end

function Table_AnimationMgr:Load(reader)
    local item = Table_AnimationItem.new();
    item:Load(reader);
    self.mItemDic[item.Id] = self.mDataCount;
    table.insert(self.mItemList, item);
end

return Table_AnimationMgr;